<?php foreach($articles as $article): ?>
<div id="<?php echo $article['Article']['id']; ?>"><?php echo $article['Article']['description']; ?>
</div>
<?php echo $ajax->drag($article['Article']['id'],array('revert'=>true));
/* the revert thing will make the draggable return to it's original position.  Set this to false and the object will stay where you put it.  This does not have anything to do with a function call being made btw, that's the job for the draggables */?>
<?php endforeach; ?>
<div id="cart"><?php echo $this->requestAction('/controller/showcart'); /* this call is not necessary.  You can use it to fill the
<div> with some content to start with */ ?></div>
<div id="thrashbin"></div>
<?php   echo $ajax->dropRemote('cart',null,array('url' => '/controller/addarticle/','with'=>'{draggedid:element.id}','update'=>'cart'));
echo $ajax->dropRemote('thrashbin',null,array('url' => '/controller/removearticle/','with'=>'{draggedid:element.id}','update'=>'cart'));
/* these two calls make objects with DOM id's 'cart' and 'thrashbin' droppable.  When an object is dropped into them, the actions defined by 'url' are called.  The 'with'=>'{draggedid:element.id} passes the id of the dropped element to the function that is called (on the background, no page refresh or anything like that!).  The update thing makes sure that the entire output of the requestAction call is displayed inside the
 <div id="cart"></div>
 So that means that the page will update the part of the page which is specified (dom id 'cart') when the output from the requestAction call is received */
?>